﻿@model PsAbsence

@{
    ViewBag.Title = "Create";
}

<div class="width80">
<h2>รายการขอลา</h2>

@using (Html.BeginForm()) {
    @*@Html.AntiForgeryToken()
    @Html.ValidationSummary(true)*@

    <fieldset>
        <legend>แบบฟอร์มบันทึก</legend>
        <h4>@ViewBag.EmpName</h4>

        <div class="editor-label">
            @Html.LabelFor(model => model.AbsenceTypeId)
        </div>
        <div class="editor-field">
            @(Html.Telerik().ComboBox()
                .Name("ddlAbsenceType")
                .BindTo(new SelectList(new GERPContext(true).PsAbsenceTypes.ToList(), "AbsenceTypeId", "AbsenceTypeName"))
                .SelectedIndex(Model != null ? (Model.AbsenceTypeId != null ? Model.AbsenceTypeId.Value : -1) : -1)
                .HighlightFirstMatch(true)
                .Filterable(filtering => filtering.FilterMode(AutoCompleteFilterMode.Contains))
            )

            @Html.ValidationMessageFor(model => model.AbsenceTypeId)
        </div>

        @*<div class="editor-label">
            @Html.LabelFor(model => model.bgm_year)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.bgm_year)
            @Html.ValidationMessageFor(model => model.bgm_year)
        </div>*@

        @*<div class="editor-label">
            @Html.LabelFor(model => model.EmpId)
        </div>
        <div class="editor-field">
            @(Html.Telerik().ComboBox()
                .Name("ddlEmp")
                .BindTo(new SelectList(new GERPContext(true).Employees.OrderBy(m => m.FirstName).ToList(), "EmpId", "FullName"))
                .SelectedIndex(Model != null ? (Model.EmpId != null ? Model.EmpId.Value : -1) : -1)
                .HighlightFirstMatch(true)
                .Filterable(filtering => filtering.FilterMode(AutoCompleteFilterMode.Contains))
            )
            @Html.ValidationMessageFor(model => model.EmpId)
        </div>*@
        <div class="left-w25">
            <div class="editor-label">
                @Html.LabelFor(model => model.StartDate)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.StartDate)
                @Html.ValidationMessageFor(model => model.StartDate)
            </div>
        </div>
        
        <div class="left-w75">
            <div class="editor-label">
                @Html.LabelFor(model => model.EndDate)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.EndDate)
                @Html.ValidationMessageFor(model => model.EndDate)
            </div>
        </div>
        <div class="left-w25">
            <div class="editor-label">
                @Html.LabelFor(model => model.StartTime)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.StartTime)
                @Html.ValidationMessageFor(model => model.StartTime)
            </div>
        </div>
        <div class="left-w75">
            <div class="editor-label">
                @Html.LabelFor(model => model.EndTime)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.EndTime)
                @Html.ValidationMessageFor(model => model.EndTime)
            </div>
        </div>
        <div class="left-w25">
            <div class="editor-label">
                @Html.LabelFor(model => model.DayCount)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(model => model.DayCount, new { enabled = false })
                @Html.ValidationMessageFor(model => model.DayCount)
            </div>
        </div>
        <div class="left-w75">
            <div class="editor-label">
                @Html.LabelFor(model => model.ContactAddress)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.ContactAddress)
                @Html.ValidationMessageFor(model => model.ContactAddress)
            </div>
        </div>
        <div class="left-w25">
            <div class="editor-label">
                @Html.LabelFor(model => model.Remarks)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Remarks)
                @Html.ValidationMessageFor(model => model.Remarks)
            </div>
        </div>
        @*<div class="editor-label">
            @Html.LabelFor(model => model.RecordStatus)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.RecordStatus)
            @Html.ValidationMessageFor(model => model.RecordStatus)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CreatedBy)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CreatedBy)
            @Html.ValidationMessageFor(model => model.CreatedBy)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CreatedWhen)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CreatedWhen)
            @Html.ValidationMessageFor(model => model.CreatedWhen)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UpdatedBy)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UpdatedBy)
            @Html.ValidationMessageFor(model => model.UpdatedBy)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UpdatedWhen)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UpdatedWhen)
            @Html.ValidationMessageFor(model => model.UpdatedWhen)
        </div>*@
        <div class="left-w75">
            <div class="editor-label">
                @Html.LabelFor(model => model.Description)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Description)
                @Html.ValidationMessageFor(model => model.Description)
            </div>
        </div>
    </fieldset>
    <p> 
        <input type="submit" value="บันทึก" />&nbsp;&nbsp;@Html.ActionLink("ย้อนกลับ", "Index")
    </p>
}
</div>

@section scripts {
    
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryui")
    @Scripts.Render("~/bundles/datepicker")
    @Styles.Render("~/Content/themes/base/css")
    <script type="text/javascript" >
        jQuery(function($) {
            $(".datepicker").datepicker({
                showOn: "focus",
                buttonImage: "../../Images/Icons/calendar.png",
                buttonImageOnly: true,
                dateFormat: "dd/mm/yy",
                isBE: false
            });
        });
    </script>
}